package com.gf.gf_data.temp.dao;

import com.gf.gf_data.temp.entity.LoginRecord;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface LoginRecordMapper {
    @Delete({
        "delete from _login_record",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into _login_record (id, account_id, ",
        "token_value, status, ",
        "login_time, logout_time)",
        "values (#{id,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, ",
        "#{tokenValue,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{loginTime,jdbcType=TIMESTAMP}, #{logoutTime,jdbcType=TIMESTAMP})"
    })
    int insert(LoginRecord record);

    int insertSelective(LoginRecord record);

    @Select({
        "select",
        "id, account_id, token_value, status, login_time, logout_time",
        "from _login_record",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    LoginRecord selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(LoginRecord record);

    @Update({
        "update _login_record",
        "set account_id = #{accountId,jdbcType=BIGINT},",
          "token_value = #{tokenValue,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "login_time = #{loginTime,jdbcType=TIMESTAMP},",
          "logout_time = #{logoutTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(LoginRecord record);
}